// pages/moodDetail/moodDetail.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    moodList: [{
        name: "开心",
        urlsrc: "/images/mood1.png"
      },
      {
        name: "伤心",
        urlsrc: "/images/mood2.png"
      },
      {
        name: "平淡",
        urlsrc: "/images/mood3.png"
      },
      {
        name: "孤独",
        urlsrc: "/images/mood4.png"
      },
      {
        name: "郁闷",
        urlsrc: "/images/mood5.png"
      },
    ],
    moodData: {}, //页面展示的心情
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    console.log(options.type, "类型");
    let index = options.type
    let arr = [{
        name: "开心",
        urlsrc: "/images/mood1.png"
      },
      {
        name: "伤心",
        urlsrc: "/images/mood2.png"
      },
      {
        name: "平淡",
        urlsrc: "/images/mood3.png"
      },
      {
        name: "孤独",
        urlsrc: "/images/mood4.png"
      },
      {
        name: "郁闷",
        urlsrc: "/images/mood5.png"
      },
    ]
    console.log(arr.length)
    for (let i = 0; i < arr.length; i++) {
      if (arr[i].name.indexOf(index) != -1) {
        console.log(arr[i].name, '111')
        that.setData({
          moodData: arr[i]
        })
      }

    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function (e) {
    console.log('分享', e)
  },
});